<include file="Public/min-header"/>
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css"/>
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <section class="content">
        <div class="container-fluid">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>提现申请</h3>
                </div>
                <div class="panel-body">
                    <div class="navbar navbar-default">
                        <form id="search-form2" class="navbar-form form-inline" method="get"
                              action="{:U('withdrawals')}">
                            <div class="form-group">
                                <label for="input-order-id" class="control-label">状态:</label>
                                <div class="form-group">
                                    <select class="form-control" id="status" name="status">
                                        <option value="">全部</option>
                                        <option value="0"
                                        <if condition="$_REQUEST['status'] heq '0'">selected</if>
                                        >申请中</option>
                                        <option value="1"
                                        <if condition="$_REQUEST['status'] eq 1">selected</if>
                                        >申请成功</option>
                                        <option value="2"
                                        <if condition="$_REQUEST['status'] eq 2">selected</if>
                                        >申请失败</option>
                                    </select>
                                </div>
                                <label for="input-order-id" class="control-label">用户ID:</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" id="user_id" placeholder="用户id"
                                           value="{$Think.request.user_id}" name="user_id"/>
                                </div>

                                <label for="input-order-id" class="control-label">收款账号:</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" id="input-order-id" placeholder="收款账号"
                                           value="{$Think.request.account_bank}" name="account_bank"/>
                                </div>

                                <label for="input-order-id" class="control-label">收款账户名:</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" id="input-order-id" placeholder="收款账户名"
                                           value="{$Think.request.account_name}" name="account_name"/>
                                </div>

                                <div class="input-group margin">
                                    <div class="input-group-addon">
                                        申请时间<i class="fa fa-calendar"></i>
                                    </div>
                                    <input type="text" id="start_time" value="{$create_time}" name="create_time"
                                           class="form-control pull-right" style="width: 200px">
                                </div>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-primary" id="button-filter search-order" type="submit"><i
                                        class="fa fa-search"></i> 筛选
                                </button>
                            </div>
                        </form>
                    </div>

                    <div id="ajax_return">

                        <div class="table-responsive">
                            <table class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th class="sorting text-left">申请ID</th>
                                    <th class="sorting text-left">用户id</th>
                                    <th class="sorting text-left">用户昵称</th>
                                    <th class="sorting text-left">申请时间</th>
                                    <th class="sorting text-left">申请金额</th>
                                    <th class="sorting text-left">银行名称</th>
                                    <th class="sorting text-left">银行账号</th>
                                    <th class="sorting text-left">银行账户</th>
                                    <th class="sorting text-left">手续费</th>
                                    <th class="sorting text-left">实际到账金额</th>
                                    
                                    
                                    <th class="sorting text-left">状态</th>
                                    <th class="sorting text-left">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <volist name="list" id="v">
                                    <tr>
                                        <td class="text-left">{$v.id}</td>
                                        <td class="text-left">
                                            {$v.user_id}
                                        </td>
                                        <td class="text-left">
                                            <a href="{:U('Admin/user/detail',array('id'=>$v[user_id]))}">
                                                {$v.nickname}
                                            </a>
                                        </td>
                                        <td class="text-left">{$v.create_time|date="Y-m-d",###}</td>
                                        <td class="text-left">{$v.money}</td>
                                        <td class="text-left">{$v.bank_name}</td>
                                        <td class="text-left">{$v.account_bank}</td>
                                        <td class="text-left">{$v.account_name}</td>
                                        
                                        <td class="text-left">{$v.withdraw_outlay}</td>
                                        <td class="text-left">{$v.withdraw_money}</td>
                                        
                                        <td class="text-left">
                                            <if condition="$v[status] eq 0">申请中</if>
                                            <if condition="$v[status] eq 1">申请成功</if>
                                            <if condition="$v[status] eq 2">申请失败</if>
                                        </td>
                                        <td class="text-left">
                                            <a href="{:U('editWithdrawals',array('id'=>$v['id'],'p'=>$_GET[p]))}"
                                               data-toggle="tooltip" title="" class="btn btn-primary"
                                               data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                            <if condition="in_array($v[status],array(0,2))">
                                                <a href="javascript:void(0);" onclick="del('{$v[id]}')"
                                                   id="button-delete6" data-toggle="tooltip" title=""
                                                   class="btn btn-danger" data-original-title="删除"><i
                                                        class="fa fa-trash-o"></i></a>
                                            </if>
                                        </td>
                                    </tr>
                                </volist>
                                </tbody>
                            </table>
                        </div>

                        <div class="row">
                            <div class="col-sm-6 text-left"></div>
                            <div class="col-sm-6 text-right">{$show}</div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script>
    // 删除操作
    function del(id) {
        if (!confirm('确定要删除吗?'))
            return false;
        $.ajax({
            url: "/index.php?m=Admin&c=Finance&a=delWithdrawals&id=" + id,
            success: function (v) {
                var v = eval('(' + v + ')');
                if (v.hasOwnProperty('status') && (v.status == 1))
                    location.href = '{:U('
                Admin / Finance / withdrawals
                ')}';
            else
                layer.msg(v.msg, {icon: 2, time: 1000}); //alert(v.msg);
            }
        });
        return false;
    }

    $(document).ready(function () {
        $('#start_time').daterangepicker({
            format: "YYYY-MM-DD",
            singleDatePicker: false,
            showDropdowns: true,
            minDate: '2016-01-01',
            maxDate: '2030-01-01',
            startDate: '2016-01-01',
            locale: {
                applyLabel: '确定',
                cancelLabel: '取消',
                fromLabel: '起始时间',
                toLabel: '结束时间',
                customRangeLabel: '自定义',
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                firstDay: 1
            }
        });
    });
</script>
</body>
</html>